{{>licenseInfo}}

#include "oatpp/web/client/HttpRequestExecutor.hpp"
#include "oatpp/parser/json/mapping/ObjectMapper.hpp"
#include "oatpp/network/tcp/client/ConnectionProvider.hpp"

{{#apiInfo}}{{#apis}}{{#operations}}
#include "{{classname}}.hpp"{{/operations}}{{/apis}}{{/apiInfo}}

static int _main_app(void) {
  /* create connection provider */
  auto connectionProvider = oatpp::network::tcp::client::ConnectionProvider::createShared({"localhost", {{serverPort}}{{^serverPort}}8080{{/serverPort}}, oatpp::network::Address::IP_4});

  /* create HTTP request executor */
  auto requestExecutor = oatpp::web::client::HttpRequestExecutor::createShared(connectionProvider);

  /* create JSON object mapper */
  auto objectMapper = oatpp::parser::json::mapping::ObjectMapper::createShared();

{{#apiInfo}}{{#apis}}{{#operations}}
  /* create API client */
  auto {{classname}}Client = {{apiNamespace}}::{{classname}}::createShared(requestExecutor, objectMapper);
{{/operations}}{{/apis}}{{/apiInfo}}

  return 0;
}

int main(int argc, char **argv) {
  /* Init oatpp Environment */
  oatpp::base::Environment::init();

  int ret = _main_app();

  /* Destroy oatpp Environment */
  oatpp::base::Environment::destroy();

  return ret;
}
